package com.gite.nouette.admin.implementation.integrator.builder;

import com.gite.nouette.admin.contract.integrator.assembler.command.IAssemblerCommandCreateModule;
import com.gite.nouette.admin.contract.integrator.factory.IFactoryModel;
import com.gite.nouette.admin.implementation.integrator.assembler.command.AssemblerCommandCreateModuleErrorImpl;
import com.gite.nouette.admin.implementation.integrator.assembler.command.AssemblerCommandCreateModuleLogImpl;

public class BuilderManagerLogImpl extends AbstractBuilderManager {

	public BuilderManagerLogImpl(IFactoryModel factoryModel) {
		super(factoryModel);
	}

	@Override
	public void buildName() {
		getProduct().setName("Log");
	}

	@Override
	public void buildColumns() {
		for (int i = 0; i < 2; i++) {
			getProduct().addColumn(i);
		}
	}

	@Override
	public void buildCommands() {
		buildCommands(new AssemblerCommandCreateModuleLogImpl(
				getFactoryModel(), getProduct()),
				new AssemblerCommandCreateModuleErrorImpl(getFactoryModel(),
						getProduct()));
	}

	private void buildCommands(
			IAssemblerCommandCreateModule... assemblerCommandCreateModules) {
		for (IAssemblerCommandCreateModule assemblerCommandCreateModule : assemblerCommandCreateModules) {
			buildCommand(assemblerCommandCreateModule);
		}
	}

	private void buildCommand(
			IAssemblerCommandCreateModule assemblerCommandCreateModule) {
		assemblerCommandCreateModule.setParentProduct(getProduct());
		assemblerCommandCreateModule.run();
	}

	@Override
	public void buildModules() {

	}
}
